<!DOCTYPE HTML>
<html lang="en">
<head>
<title>#ClipboardTimeout - Syntax &amp; Usage | AutoHotkey</title>
<meta name="description" content="The #ClipboardTimeout directive changes how long the script keeps trying to access the clipboard when the first attempt fails." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>#ClipboardTimeout</h1>

<p>Changes how long the script keeps trying to access the clipboard when the first attempt fails.</p>

<pre class="Syntax"><span class="func">#ClipboardTimeout</span> Milliseconds</pre>
<h2>Parameters</h2>
<dl>

  <dt>Milliseconds</dt>
  <dd><p>The length of the interval in milliseconds. Specify -1 to have it keep trying indefinitely. Specify 0 to have it try only once. Scripts that do not contain this directive use a 1000 ms timeout.</p></dd>

</dl>
<h2>Remarks</h2>
<p>Some applications keep the clipboard open for long periods of time, perhaps to write or read large amounts of data. In such cases, increasing this setting causes the script to wait longer before giving up and displaying an error message.</p>
<p>This settings applies to all <a href="../misc/Clipboard.htm">clipboard</a> operations, the simplest of which are the following examples: <code>Var := Clipboard</code> and <code>Clipboard := "New Text"</code>.</p>
<p>Whenever the script is waiting for the clipboard to become available, new <a href="../misc/Threads.htm">threads</a> <u>cannot</u> be launched and <a href="SetTimer.htm">timers</a> will not run. However, if the user presses a <a href="../Hotkeys.htm">hotkey</a>, selects a <a href="Menu.htm">custom menu item</a>, or performs a <a href="Gui.htm">GUI action</a> such as pressing a button, that event will be buffered until later; in other words, its subroutine will be performed after the clipboard finally becomes available.</p>
<p>This directive does <strong>not</strong> cause the reading of clipboard data to be reattempted if the first attempt fails. Prior to <span class="ver">[v1.1.16]</span>, it did cause the script to wait until the timeout expired, but in doing so prevented any further data from being retrieved.</p>
<h2>Related</h2>
<p><a href="../misc/Clipboard.htm">Clipboard</a>, <a href="Thread.htm">Thread</a></p>
<h2>Examples</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>#ClipboardTimeout 2000</pre>
</div>

</body>
</html>
